package HDFS;

import java.util.List;

public class HdfsDirTest {
    public static void main(String[] args) {
        try {
            List<String> dirs = HdfsUtils.listAll(HdfsUtils.getCompleteDirOfHDFS("/"));
            for (String dir : dirs) {
                System.err.println(dir);
            }
            System.err.println("\n");
            HdfsUtils.mkdir(HdfsUtils.getCompleteDirOfHDFS("/hdfs/test"));
            dirs = HdfsUtils.listAll(HdfsUtils.getCompleteDirOfHDFS("/"));
            for (String dir : dirs) {
                System.err.println(dir);
            }
            System.err.println("\n");
            HdfsUtils.rename(HdfsUtils.getCompleteDirOfHDFS("/hdfs"), HdfsUtils.getCompleteDirOfHDFS("/hdfs1"));
            dirs = HdfsUtils.listAll(HdfsUtils.getCompleteDirOfHDFS("/"));
            for (String dir : dirs) {
                System.err.println(dir);
            }
            System.err.println("\n");
            HdfsUtils.deleteDir(HdfsUtils.getCompleteDirOfHDFS("/hdfs1"));
            dirs = HdfsUtils.listAll(HdfsUtils.getCompleteDirOfHDFS("/"));
            for (String dir : dirs) {
                System.err.println(dir);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
